package tt.dz.egobus.servicemanager.business.point;

import com.alibaba.fastjson.JSON;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import tt.dz.egobus.bean.BaseBean;

/**
 * @author Anson
 * @date 17-3-23
 * @name 公共的经纬度位置
 * @since 1.0.2
 */
public class CommonPoint implements BaseBean, Point {


    private static final Logger LOGGER = LoggerFactory.getLogger(CommonPoint.class);
    private static final long serialVersionUID = 4718296915738210153L;


    @Override
    public double x() {
        return this.x;
    }

    @Override
    public double y() {
        return this.y;
    }

    @Override
    public double distance(Point point) {
        return this.distance(point.x(), point.y());
    }

    @Override
    public double distancePoint(Point point) {
        return this.distancePoint(point.x(), point.y());
    }


    @Override
    public double distance(double x, double y) {
        return PointAlgorithmHelp.accDistanceByPoint(this.x(), this.y(), x, y);
    }

    @Override
    public double distancePoint(double x, double y) {
        return PointAlgorithmHelp.accPointLength(this.x(), this.y(), x, y);
    }


    /**
     * @author Anson
     * @date 17-3-23
     * @name 获取当前json值
     * @since 1.0.2
     */
    public String toJson() {
        return JSON.toJSONString(this);
    }

    protected double x;

    protected double y;

    public CommonPoint() {

    }

    public CommonPoint(double x, double y) {
        this.x = x;
        this.y = y;
    }


    public double getX() {
        return x;
    }

    public void setX(double x) {
        this.x = x;
    }

    public double getY() {
        return y;
    }

    public void setY(double y) {
        this.y = y;
    }



}